{% extends 'base1.html' %}
{% block body %}
    <div class="header_con">
        <div class="header">
            <div class="welcome fl">欢迎来到天天生鲜!</div>
{#                <div class="fr">#}
{##}
{#                {% if request.session.user_names %}#}
{#                    <div class="login_info fl">#}
{#					欢迎您：<em>{{ request.session.user_names }}</em>#}
{#                    <a href="/logout/">退出</a>#}
{#				    </div>#}
{#                    <div class="user_link fl">#}
{#					<span>|</span>#}
{#					<a href="{% url 'info' %}">用户中心</a>#}
{#					<span>|</span>#}
{#					<a href="/cart">我的购物车</a>#}
{#					<span>|</span>#}
{#					<a href="url {% url 'u_order' %}">我的订单</a>#}
{#				</div>#}
{#                {% else %}#}
{#                    <div class="login_btn fl">#}
{#					<a href="{% url 'login' %}">登录</a>#}
{#					<span>|</span>#}
{#					<a href="{% url 'register' %}">注册</a>#}
{#				    </div>#}
{#                {% endif %}#}
{#			</div>#}
            <div class="fr">

                {% if request.session.user_name %}
                    <div class="login_info fl">
                        欢迎您：<em>{{ request.session.user_name }}  </em>
                    <a href="{% url 'logout' %}">退出</a>
                    </div>
                     <div class="user_link fl">
                    <span>|</span>
                    <a href="{% url 'info' %}">用户中心</a>
                    <span>|</span>
                    <a href="/cart">我的购物车</a>
                    <span>|</span>
                    <a href="{% url 'u_order' %}">我的订单</a>
                </div>
                {% else %}

                    <div class="login_btn fl">
                        <a href="{% url 'login' %}">登录</a>
                        <span>|</span>
                        <a href="{% url 'register' %}">注册</a>
                    </div>

                {% endif %}


            </div>
        </div>
    </div>
    {% if isCart %}
        <div class="search_bar clearfix">
            <a href="/" class="logo fl"><img src="/static/images/logo.png"></a>
            <div class="search_con fl">
                <form action="/search/">
                <input type="text" class="input_text fl" name="q" placeholder="搜索商品">
                <input type="button" class="input_btn fr" name="" value="搜索">
                </form>
            </div>
            <div class="guest_cart fr">
                <a href="/cart" class="cart_name fl">我的购物车</a>
                <div class="goods_count fl" id="show_count">1</div>
            </div>
        <script>
            if ('{{ request.session.user_id}}') {
                //如果用户登录了
                $.get('/cart/count/', function (data) {
                    $('#show_count').html(data.count);
                })
            } else {
                $('#show_count').html(0);
            }
        </script>
        </div>




    {% else %}
        <div class="search_bar clearfix">
            <a href="/" class="logo fl"><img src="/static/images/logo.png"></a>
            <div class="sub_page_name fl">|&nbsp;&nbsp;&nbsp;&nbsp;{{ title }}</div>
            <div class="search_con fr">
                <form action="/search/">
                <input type="text" class="input_text fl" name="q" placeholder="搜索商品">
                <input type="button" class="input_btn fr" name="" value="搜索">
                </form>
            </div>
        </div>
    {% endif %}

    {% block content %}


    {% endblock %}

{% endblock %}